package com.biubiux2.async;

import com.biubiux2.dialog.Order;
import com.lmax.disruptor.EventFactory;

import java.util.concurrent.LinkedBlockingDeque;

/**
 * @author Lijinbao
 * @since 8/8/2022 11:39 AM
 */
public class MsgEventFactory implements EventFactory<Order> {

    public LinkedBlockingDeque<Order> deque;

    @Override
    public Order newInstance() {
        try {
            return deque.takeFirst();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
